plot.margin = margin(0, 0, 0, 2, "pt"))
d = subset(df, modellab == mods[4])
xmin = min(d$low95)
xmax = max(d$hi95)
p4 <- ggplot(d,
aes(x = coef, y = dv)) +
geom_vline(xintercept = 0, lty=2) +
geom_point(alpha = d$alph, color = d$col) +
geom_segment(aes(x = low95, xend = hi95,
y = dv, yend = dv),
alpha = d$alph, color = d$col) +
scale_x_continuous(name = NULL,
limits = c(xmin-.02, xmax+.02),
breaks = round(seq(xmin, xmax, length.out = 3),2)) +
scale_y_discrete(name = NULL,
labels = NULL) +
facet_grid(rows = vars(category), cols = vars(modellab),
scales = "free", space = "free_y") +
theme_bw() +
theme(strip.background.y = element_blank(),
strip.text.y = element_blank(),
plot.margin = margin(0, 0, 0, 2, "pt"))
d = subset(df, modellab == mods[5])
xmin = min(d$low95)
xmax = max(d$hi95)
p5 <- ggplot(d,
aes(x = coef, y = dv)) +
geom_vline(xintercept = 0, lty=2) +
geom_point(alpha = d$alph, color = d$col) +
geom_segment(aes(x = low95, xend = hi95,
y = dv, yend = dv),
alpha = d$alph, color = d$col) +
scale_x_continuous(name = NULL,
limits = c(xmin-.02, xmax+.02),
breaks = round(seq(xmin, xmax, length.out = 3),2)) +
scale_y_discrete(name = NULL,
labels = NULL) +
facet_grid(rows = vars(category), cols = vars(modellab),
scales = "free", space = "free_y") +
theme_bw() +
theme(strip.background.y = element_blank(),
strip.text.y = element_blank(),
plot.margin = margin(0, 0, 0, 2, "pt"))
d = subset(df, modellab == mods[6])
xmin = min(d$low95)
xmax = max(d$hi95)
p6 <- ggplot(d,
aes(x = coef, y = dv)) +
geom_vline(xintercept = 0, lty=2) +
geom_point(alpha = d$alph, color = d$col) +
geom_segment(aes(x = low95, xend = hi95,
y = dv, yend = dv),
alpha = d$alph, color = d$col) +
scale_x_continuous(name = NULL,
limits = c(xmin-.02, xmax+.02),
breaks = round(seq(xmin, xmax, length.out = 3),2)) +
scale_y_discrete(name = NULL,
labels = NULL) +
facet_grid(rows = vars(category), cols = vars(modellab),
scales = "free", space = "free_y") +
theme_bw() +
theme(strip.background.y = element_blank(),
strip.text.y = element_blank(),
plot.margin = margin(0, 0, 0, 2, "pt"))
d = subset(df, modellab == mods[7])
xmin = min(d$low95)
xmax = max(d$hi95)
p7 <- ggplot(d,
aes(x = coef, y = dv)) +
geom_vline(xintercept = 0, lty=2) +
geom_point(alpha = d$alph, color = d$col) +
geom_segment(aes(x = low95, xend = hi95,
y = dv, yend = dv),
alpha = d$alph, color = d$col) +
scale_x_continuous(name = NULL,
limits = c(xmin-.02, xmax+.02),
breaks = round(seq(xmin, xmax, length.out = 3),2)) +
scale_y_discrete(name = NULL,
labels = NULL) +
facet_grid(rows = vars(category), cols = vars(modellab),
scales = "free", space = "free_y") +
theme_bw() +
theme(plot.margin = margin(0, 0, 0, 2, "pt"))
p <- p1 + p2 + p3 + p4 + p5 + p6 + p7 + plot_layout(nrow=1)
p
ggsave(p, filename = "Figure-5.pdf", width = 10)
spec1 = read.csv("./coefs_int_ind_cov/edu.csv", header=TRUE)
spec2 = read.csv("./coefs_int_ind_cov/cognitive.csv", header=TRUE)
spec3 = read.csv("./coefs_int_ind_cov/infosources.csv", header=TRUE)
spec4 = read.csv("./coefs_int_kec_cov/medianedu.csv", header=TRUE)
df = rbind(spec1, spec2, spec3, spec4)
dvs = c("Object: Live in Same Village",
"Object: Live in Same Neighborhood",
"Object: Live in Same House",
"Object: Worship House", "Object: Intermarriage",
"Prefer Muslim Candidate", "Prefer Co-Ethnic Candidate",
"Trust Fellow Muslims", "Trust Co-Ethnics",
"Helping Neighbors")
df$dv = dvs
df$dv = factor(df$dv, levels = dvs[length(dvs):1])
mods = c("Education\n(Individual)",
"Cognitive\nAbility\n(Individual)",
"Information\nSources\n(Individual)",
"Median Level\nof Education\n(Kecamatan)")
ndv = length(unique(df$dv))
df$modellab = rep(mods, times = rep(ndv, length(mods)))
df$modellab = factor(df$modellab, levels = mods)
df$category = NA
df$category[df$dv %in% c("Object: Live in Same Village",
"Object: Live in Same Neighborhood",
"Object: Live in Same House",
"Object: Worship House",
"Object: Intermarriage")] = "Outgroup\nRejection"
df$category[df$dv %in% c("Prefer Muslim Candidate",
"Prefer Co-Ethnic Candidate")] = "Political\nPreferences"
df$category[df$dv %in% c("Trust Fellow Muslims",
"Trust Co-Ethnics",
"Helping Neighbors")] = "Ingroup\nAttitudes"
df$category = factor(df$category,
levels = c("Outgroup\nRejection",
"Political\nPreferences",
"Ingroup\nAttitudes"))
df$low95 = df$coef - qnorm(.975)*df$se
df$hi95 = df$coef + qnorm(.975)*df$se
df$col = "darkgrey"
df$col[(df$coef < 0) & (df$p<=.05)] = "red"
df$col[(df$coef > 0) & (df$p<=.05)] = "blue"
df$alph = .6
df$alph[df$p<=.05] = 1
d = subset(df, modellab == "Education\n(Individual)")
xmin = min(d$low95)
xmax = max(d$hi95)
p1 <- ggplot(d,
aes(x = coef, y = dv)) +
geom_vline(xintercept = 0, lty=2) +
geom_point(alpha = d$alph, color = d$col) +
geom_segment(aes(x = low95, xend = hi95,
y = dv, yend = dv),
alpha = d$alph, color = d$col) +
scale_x_continuous(name = NULL,
limits = c(xmin-.02, xmax+.02),
breaks = round(seq(xmin, xmax, length.out = 3),2)) +
scale_y_discrete(name = NULL) +
facet_grid(rows = vars(category), cols = vars(modellab),
scales = "free", space = "free_y") +
theme_bw() +
theme(strip.background.y = element_blank(),
strip.text.y = element_blank(),
plot.margin = margin(0, 0, 0, 0, "pt"))
d = subset(df, modellab == "Cognitive\nAbility\n(Individual)")
xmin = min(d$low95)
xmax = max(d$hi95)
p2 <- ggplot(d,
aes(x = coef, y = dv)) +
geom_vline(xintercept = 0, lty=2) +
geom_point(alpha = d$alph, color = d$col) +
geom_segment(aes(x = low95, xend = hi95,
y = dv, yend = dv),
alpha = d$alph, color = d$col) +
scale_x_continuous(name = NULL,
limits = c(xmin-.02, xmax+.02),
breaks = round(seq(xmin, xmax, length.out = 3),2)) +
scale_y_discrete(name = NULL,
labels = NULL) +
facet_grid(rows = vars(category), cols = vars(modellab),
scales = "free", space = "free_y") +
theme_bw() +
theme(strip.background.y = element_blank(),
strip.text.y = element_blank(),
plot.margin = margin(0, 0, 0, 2, "pt"))
d = subset(df, modellab == "Information\nSources\n(Individual)")
xmin = min(d$low95)
xmax = max(d$hi95)
p3 <- ggplot(d,
aes(x = coef, y = dv)) +
geom_vline(xintercept = 0, lty=2) +
geom_point(alpha = d$alph, color = d$col) +
geom_segment(aes(x = low95, xend = hi95,
y = dv, yend = dv),
alpha = d$alph, color = d$col) +
scale_x_continuous(name = NULL,
limits = c(xmin-.02, xmax+.02),
breaks = round(seq(xmin, xmax, length.out = 3),2)) +
scale_y_discrete(name = NULL,
labels = NULL) +
facet_grid(rows = vars(category), cols = vars(modellab),
scales = "free", space = "free_y") +
theme_bw() +
theme(strip.background.y = element_blank(),
strip.text.y = element_blank(),
plot.margin = margin(0, 0, 0, 2, "pt"))
d = subset(df, modellab == "Median Level\nof Education\n(Kecamatan)")
xmin = min(d$low95)
xmax = max(d$hi95)
p4 <- ggplot(d,
aes(x = coef, y = dv)) +
geom_vline(xintercept = 0, lty=2) +
geom_point(alpha = d$alph, color = d$col) +
geom_segment(aes(x = low95, xend = hi95,
y = dv, yend = dv),
alpha = d$alph, color = d$col) +
scale_x_continuous(name = NULL,
limits = c(xmin-.02, xmax+.02),
breaks = round(seq(xmin, xmax, length.out = 3),2)) +
scale_y_discrete(name = NULL,
labels = NULL) +
facet_grid(rows = vars(category), cols = vars(modellab),
scales = "free", space = "free_y") +
theme_bw() +
theme(plot.margin = margin(0, 0, 0, 2, "pt"))
p <- p1 + p2 + p3 + p4 + plot_layout(nrow=1)
p
ggsave(p, filename = "Figure-8.pdf")
rm(list=ls())
source("packages.R")
rm(list=ls())
source("extras/packages.R")
load("data/WVS_Cross-National_Wave_7_rData_v5_0.rData")
dat = `WVS_Cross-National_Wave_7_v5_0`
### keep only relevant columns
# Q171: attend religious service
# Q289: religious denomination
cols = c("B_COUNTRY", "B_COUNTRY_ALPHA", "Q171", "Q289")
dat = dat[,cols]
colnames(dat) = c("code", "alpha", "relservice", "relgroup")
### recode vars to ensure correct values
dat$relgroup[!(dat$relgroup %in% 0:9)] = 0
dat$relgroup2pt = car::recode(dat$relgroup, "0=0 ; 1:9 = 1")
dat$relservice[!(dat$relservice %in% 1:7)] = 0
#dat$relservice[dat$relgroup2pt == 0] = NA
dat$relservice2pt = car::recode(dat$relservice, "1:3 = 1; 4:7 = 0")
### collapse data
temp <- dat %>%
group_by(code, alpha) %>%
dplyr::summarise(relservice2pt = round(mean(relservice2pt, na.rm=TRUE)*100,2),
relgroup2pt = round(mean(relgroup2pt, na.rm=TRUE)*100,2))
### create country codes
ref = read.xlsx2("data/F00012255-WVS_TimeSeries_1981_2020_CountrySpecificCodes.xlsx", sheetIndex = 1,
header = FALSE)
colnames(ref) = c("code", "region")
### merge country names and collapsed data
temp = merge(x = temp, y = ref,
all.x = TRUE, all.y = FALSE)
### sort
temp = temp[order(temp$relgroup2pt, decreasing = TRUE),]
temp = temp[1:30, ]
### create long format
ctydat = data.frame(country = c(temp$region, temp$region),
var = rep(c("Identifying with a Religion",
"Attending Service at least Monthly"),
each = nrow(temp)),
value = c(temp$relgroup2pt, temp$relservice2pt))
ctydat$country = factor(ctydat$country, levels = temp$region[nrow(temp):1])
ctydat_relgroup = subset(ctydat, var == "Identifying with a Religion")
ctydat_relservice = subset(ctydat, var == "Attending Service at least Monthly")
p <- ggplot(ctydat) +
geom_segment(data = ctydat_relservice,
aes(x = value, xend = ctydat_relgroup$value,
y = country, yend = ctydat_relgroup$country),
color = "#aeb6bf",
linewidth = 1.5,
alpha = .5) +
geom_point(aes(x = value, y = country, color = var, shape = var), size = 2.5, show.legend = TRUE) +
scale_x_continuous(name = "Percentage",
breaks = seq(0, 100, 10),
limits = c(0, 100)) +
labs(color = "",
shape = "",
y = "Country") +
theme_bw() +
theme(legend.position = "bottom")
ggsave(p, filename="Figure-1.pdf", height = 8, width = 9)
mosque = read.csv("data/Mosque and Mushalla.csv",
header=TRUE)
mosque = subset(mosque, type == "mosque")
save(mosque, file = "mosque_data.RData")
### mosque data
load("data/mosque_data.RData")
dat = read.dta13("data/dat_kec_long.dta", convert.factors = TRUE)
save(dat, file = "dat_kec_long.RData")
load("dat_kec_long.RData")
load("dat_kec_long.RData")
dat = read.dta13("data/dat_kec_long.dta", convert.factors = TRUE)
save(dat, file = "dat_kec_long.rData")
load("dat_kec_long.rData")
load("data/dat_kec_long.rData")
rm(list=ls())
source("packages.R")
rm(list=ls())
source("extras/packages.R")
### LONG FORMAT ################################################################################3
dat = read.dta13("dat_kec_long.dta", convert.factors = TRUE)
cols_tokeep = c("pidlink", "kecid", "nmprov_mosque", "nmkab_mosque", "nmkec_mosque", "pr_wakaf13_mo", "kecid14",
"reltrad_nu", "reltrad_numuha", "reltrad_3pt", "religion_07", "religion_14",
"cellphone_socmed_14", "cellphone_internet_14", "own_tv_2014", "w_abilrc_14",
"n_mo_07", "n_mo_13", "change_mo_07_13",
"n_mu_07", "n_mu_13", "change_mu_07_13",
"n_mo_00", "n_mo_06", "change_mo_00_06",
"n_mo_10", "n_mo_22", "change_mo_10_22", "n_mo_14",
"change_mo_08_13", "change_mo_09_13", "change_mo_10_13", "change_mo_11_13", "change_mo_12_13",
"ln_n_mo_07", "javaisland", "prop_kec_nu", "prop_kec_muha", "prop_kec_numuha",
"census10_prop_male", "census10_median_age", "census10_median_edu", "census10_prop_working", "census10_prop_muslim",
"census10_diversity_lang", "census10_total_pop", "elec14_kec_jokowi_share", "elec19_jokowi_share",
"elec19_islamist_share", "mig_status", "kabid", "year",
"helping", "helping2pt", "live_village", "live_neighborhood", "live_room", "live_village2pt",
"live_neighborhood2pt", "live_room2pt", "intermarriage", "worship_house", "intermarriage2pt", "worship_house2pt",
"trust_religion", "trust_ethnicity", "trust_religion2pt", "trust_ethnicity2pt",
"similar_religion", "similar_ethnicity", "how_religious", "how_religious2pt", "shalat3pt", "shalat2pt",
"communal_pray", "female", "age", "edu", "marital", "work_lastyear", "income", "isfriday",
"papers_idlang", "papers_othlang")
cols_tokeep[which(!(cols_tokeep %in% colnames(dat)))]
dat = dat[, cols_tokeep]
save(data=dat, file="dat_kec_long.rData")
### WIDE FORMAT ################################################################################3
dat = read.dta13("dat_kec_wide.dta", convert.factors = TRUE)
cols_tokeep = c("pidlink", "kecid", "nmprov_mosque", "nmkab_mosque", "nmkec_mosque", "pr_wakaf13_mo", "kecid14",
"reltrad_nu", "reltrad_numuha", "reltrad_3pt", "religion_07", "religion_14",
"cellphone_socmed_14", "cellphone_internet_14", "own_tv_2014", "w_abilrc_14",
"n_mo_07", "n_mo_13", "change_mo_07_13",
"n_mu_07", "n_mu_13", "change_mu_07_13",
"n_mo_00", "n_mo_06", "change_mo_00_06",
"n_mo_10", "n_mo_22", "change_mo_10_22", "n_mo_14",
"change_mo_08_13", "change_mo_09_13", "change_mo_10_13", "change_mo_11_13", "change_mo_12_13",
"ln_n_mo_07", "javaisland", "prop_kec_nu", "prop_kec_muha", "prop_kec_numuha",
"census10_prop_male", "census10_median_age", "census10_median_edu", "census10_prop_working", "census10_prop_muslim",
"census10_diversity_lang", "census10_total_pop", "elec14_kec_jokowi_share", "elec19_jokowi_share",
"elec19_islamist_share", "mig_status", "kabid",
"helping_07", "helping2pt_07", "live_village_07", "live_neighborhood_07", "live_room_07", "live_village2pt_07",
"live_neighborhood2pt_07", "live_room2pt_07", "intermarriage_07", "worship_house_07", "intermarriage2pt_07", "worship_house2pt_07",
"trust_religion_07", "trust_ethnicity_07", "trust_religion2pt_07", "trust_ethnicity2pt_07",
"similar_religion_07", "similar_ethnicity_07", "how_religious_07", "how_religious2pt_07", "shalat3pt_07", "shalat2pt_07",
"communal_pray_07", "female_07", "age_07", "edu_07", "marital_07", "work_lastyear_07", "income_07", "isfriday_07",
"papers_idlang_07", "papers_othlang_07",
"helping_14", "helping2pt_14", "live_village_14", "live_neighborhood_14", "live_room_14", "live_village2pt_14",
"live_neighborhood2pt_14", "live_room2pt_14", "intermarriage_14", "worship_house_14", "intermarriage2pt_14", "worship_house2pt_14",
"trust_religion_14", "trust_ethnicity_14", "trust_religion2pt_14", "trust_ethnicity2pt_14",
"similar_religion_14", "similar_ethnicity_14", "how_religious_14", "how_religious2pt_14", "shalat3pt_14", "shalat2pt_14",
"communal_pray_14", "female_14", "age_14", "edu_14", "marital_14", "work_lastyear_14", "income_14", "isfriday_14",
"papers_idlang_14", "papers_othlang_14"
)
cols_tokeep[which(!(cols_tokeep %in% colnames(dat)))]
dat = dat[, cols_tokeep]
save(data=dat, file="dat_kec_wide.rData")
rm(list=ls())
source("extras/packages.R")
source("extras/functions.R")
library("flextable")
# webshot::install_phantomjs(force = TRUE)
knitr::opts_chunk$set(rows.print=100)
load("data/dat_kec_long.rData")
dat = subset(dat,
subset = (religion_07 == 1) & (religion_14 == 1) &
(census10_prop_muslim >= .5) & (mig_status == "stayer"))
cols = c("year", "change_mo_07_13", "n_mo_07",
"nmprov_mosque", "nmkab_mosque", "nmkec_mosque", "kecid")
dat = dat[complete.cases(dat[,cols]), cols]
df = dat %>%
group_by(kecid) %>%
dplyr::summarise(change_mo_07_13 = mean(change_mo_07_13, na.rm=TRUE),
n_mo_07 = mean(n_mo_07, na.rm=TRUE))
tab = data.frame(table(df$change_mo_07_13))
tab$Var1 = as.character(tab$Var1)
tab$Var1 = as.numeric(tab$Var1)
p = ggplot(tab, aes(x = Var1, y = Freq)) +
geom_bar(stat = "identity") +
scale_x_continuous(name = "Number of New Mosques (2007-2013)",
breaks = seq(0, max(tab$Var1), 5)) +
scale_y_continuous(name = "Number of Districts", breaks = seq(0, 200, 20)) +
labs(subtitle = "Histogram of New Mosques (2007-2013) in Analyzed Districts") +
theme_bw()
p
tab1 = data.frame(table(df$change_mo_07_13))
colnames(tab1) = c("Number of New Mosques", "Frequency")
tab2 = data.frame(round(prop.table(table(df$change_mo_07_13)),3))
colnames(tab2) = c("Number of New Mosques", "Proportion")
tab = cbind(tab1, tab2$Proportion)
colnames(tab) = c("Number of New Mosques", "Frequency", "Proportion")
out <- flextable(tab)
out <- fontsize(out, size = 7, part = "all")
out <- set_table_properties(out, width = .8, layout = "autofit")
out
load("data/WVS_Cross-National_Wave_7_rds_v6_0")
load("data/WVS_Cross-National_Wave_7_rds_v6_0.rds")
readRDS("data/WVS_Cross-National_Wave_7_rds_v6_0.rds")
dat = readRDS("data/WVS_Cross-National_Wave_7_rds_v6_0.rds")
rm(list=ls())
library("ggplot2")
library("tidyverse")
dat = readRDS("data/WVS_Cross-National_Wave_7_rds_v6_0.rds")
### keep only relevant columns
# Q171: attend religious service
# Q289: religious denomination
cols = c("B_COUNTRY", "B_COUNTRY_ALPHA", "Q171", "Q289")
dat = dat[,cols]
colnames(dat) = c("code", "alpha", "relservice", "relgroup")
### recode vars to ensure correct values
dat$relgroup[!(dat$relgroup %in% 0:9)] = 0
rm(list=ls())
source("extras/packages.R")
dat = readRDS("data/WVS_Cross-National_Wave_7_rds_v6_0.rds")
### keep only relevant columns
# Q171: attend religious service
# Q289: religious denomination
cols = c("B_COUNTRY", "B_COUNTRY_ALPHA", "Q171", "Q289")
dat = dat[,cols]
colnames(dat) = c("code", "alpha", "relservice", "relgroup")
### recode vars to ensure correct values
dat$relgroup[!(dat$relgroup %in% 0:9)] = 0
dat$relgroup2pt = car::recode(dat$relgroup, "0=0 ; 1:9 = 1")
dat$relservice[!(dat$relservice %in% 1:7)] = 0
#dat$relservice[dat$relgroup2pt == 0] = NA
dat$relservice2pt = car::recode(dat$relservice, "1:3 = 1; 4:7 = 0")
### collapse data
temp <- dat %>%
group_by(code, alpha) %>%
dplyr::summarise(relservice2pt = round(mean(relservice2pt, na.rm=TRUE)*100,2),
relgroup2pt = round(mean(relgroup2pt, na.rm=TRUE)*100,2))
### create country codes
ref = read.xlsx2("data/F00012255-WVS_TimeSeries_1981_2020_CountrySpecificCodes.xlsx", sheetIndex = 1,
header = FALSE)
colnames(ref) = c("code", "region")
### merge country names and collapsed data
temp = merge(x = temp, y = ref,
all.x = TRUE, all.y = FALSE)
### sort
temp = temp[order(temp$relgroup2pt, decreasing = TRUE),]
temp = temp[1:30, ]
### create long format
ctydat = data.frame(country = c(temp$region, temp$region),
var = rep(c("Identifying with a Religion",
"Attending Service at least Monthly"),
each = nrow(temp)),
value = c(temp$relgroup2pt, temp$relservice2pt))
ctydat$country = factor(ctydat$country, levels = temp$region[nrow(temp):1])
ctydat_relgroup = subset(ctydat, var == "Identifying with a Religion")
ctydat_relservice = subset(ctydat, var == "Attending Service at least Monthly")
p <- ggplot(ctydat) +
geom_segment(data = ctydat_relservice,
aes(x = value, xend = ctydat_relgroup$value,
y = country, yend = ctydat_relgroup$country),
color = "#aeb6bf",
linewidth = 1.5,
alpha = .5) +
geom_point(aes(x = value, y = country, color = var, shape = var), size = 2.5, show.legend = TRUE) +
scale_x_continuous(name = "Percentage",
breaks = seq(0, 100, 10),
limits = c(0, 100)) +
labs(color = "",
shape = "",
y = "Country") +
theme_bw() +
theme(legend.position = "bottom")
ggsave(p, filename="Figure-1.pdf", height = 8, width = 9)
load("data/dat_kec_long.RData")
rm(list=ls())
source("extras/packages.R")
source("extras/functions.R")
knitr::opts_chunk$set(rows.print=100)
coefs = read.csv("./coefs_robust_placebo/coefs_main_models.csv", header=TRUE)
coefs$low99 = coefs$coef - qnorm(.995) * coefs$se
coefs$hi99 = coefs$coef + qnorm(.995) * coefs$se
coefs$low95 = coefs$coef - qnorm(.975) * coefs$se
coefs$hi95 = coefs$coef + qnorm(.975) * coefs$se
coefs$low90 = coefs$coef - qnorm(.95) * coefs$se
coefs$hi90 = coefs$coef + qnorm(.95) * coefs$se
dvs = c("Object: Live in Same Village (a)",
"Object: Live in Same Neighborhood (a)",
"Object: Live in Same House (a)",
"Object: Worship House (b)",
"Object: Intermarriage (a)",
"Prefer Muslim Candidate (c)",
"Prefer Co-Ethnic Candidate (c)",
"Trust Fellow Muslims (d)",
"Trust Co-Ethnics (a)",
"Helping Neighbors (a)")
coefs$category = c(rep("Outgroup\nRejection", 5),
rep("Political\nPreferences", 2),
rep("Ingroup\nAttitudes", 3))
coefs$category = factor(coefs$category,
levels = c("Outgroup\nRejection", "Political\nPreferences",
"Ingroup\nAttitudes"))
coefs$dv = dvs
coefs$dv = factor(coefs$dv,
levels = coefs$dv[length(dvs):1])
idx = which(coefs$p < (.05/nrow(coefs)))
p <- ggplot(coefs,
aes(x = dv, y = coef)) +
geom_hline(yintercept = 0,
colour = "red", lty = 2.5) +
geom_point(aes(x = dv,
y = coef), cex=2) +
geom_linerange(aes(x = dv,
ymin = low95,
ymax = hi95),
linewidth = 1) +
# geom_linerange(aes(x = dv,
#              ymin = low99,
#              ymax = hi99),
#            linewidth = .5) +
scale_x_discrete(name = "Dependent Variables") +
scale_y_continuous(name = "ATT") +
labs(title = "Effects of New Mosques across Dependent Variables",
subtitle = "(95% Confidence Interval)",
caption = "a: 16,238 respondents in 1,080 districts     c: 16,144 respondents in 1,077 districts\nb: 16,237 respondents in 1,080 districts     d: 16,236 respondents in 1,080 districts\n") +
coord_flip() +
facet_grid(rows = vars(category),
scales = "free", space = "free_y") +
theme_bw() +
theme(axis.text=element_text(size=11))
p
ggsave(filename = "Figure-3.pdf", p, fig.width = 10, fig.height = 8)
ggsave(filename = "Figure-3.pdf", p, width = 10, height = 8)
